package com.hejjon.knowledgebase.util;

import java.util.Map;

/**
 * @author:
 * @date: 2022-12-12 14:17:57
 * @since: 1.0
 */
public class Strings {


    /**
     * 格式化字符串 ${}
     *
     * @param str 字符串
     * @param map ${key} = value
     * @return str
     */
    public static String format(String str, Map<?, ?> map) {
        for (Map.Entry<?, ?> entry : map.entrySet()) {
            str = str.replaceAll("\\$\\{" + entry.getKey() + "}", entry.toString());
        }
        return str;
    }


}
